In the Song dynasty, the growth of commerce and urban society created a demand for many new forms of popular entertainment. "Stories about criminal cases" were among the new types of vernacular fiction that developed from the Song to the Ming periods. Written in colloquial rather than literary Chinese, they nearly always featured district magistrates or judges in the higher courts. The plots usually begin with a description of the crime (often including much realistic detail of contemporary life) and culminate in the exposure of the deed and the punishment of the guilty. Sometimes two solutions to a mystery are posited, but the correct solution is reached through a brilliant judge.
The most celebrated hero of such tales was Judge Bao Zheng, or "Dragon Plan Bao," who was originally based on a historical person. Featuring in hundreds of stories, Bao became the archetype of the incorruptible official in a society in which miscarriages of justice in favor of the rich and powerful were all too common. Not all crime stories have happy endings, and some were evidently written with the aim of exposing the brutal methods of corrupt judges who—often after accepting bribes—extracted false confessions by torture and condemned innocent people to death.
In some tales, the crimes are exposed with the aid of supernatural forces, but others display features common in Western crime fiction. For example, in one tale the dimwitted investigator is upstaged by the patient and methodical investigation of his junior.